<template>
    <van-nav-bar title="商品列表" left-text="返回" left-arrow @click-left="() => { $router.push('/home/cla') }" fixed />
    <div style="height: 45px;"></div>
    <div v-for="item in goodsApiData">
        <router-link :to="{ name: 'detail', params: { goods_id: item.goods_id } }">
            <van-card :title="item.goods_name" :thumb="item.goods_small_logo ? item.goods_small_logo:'https://fastly.jsdelivr.net/npm/@vant/assets/ipad.jpeg'" />
        </router-link>
    </div>
</template>

<script setup>
import { goodsApi } from '@/api/api';
import { ref } from 'vue'
import { useRoute } from 'vue-router';
let route = useRoute()
let goodsApiData = ref([])
goodsApi(route.params.query).then(res => {
    goodsApiData.value = res.data.message.goods
})
</script>

<style lang="scss" scoped></style>